﻿
    //ly 为层ID，aly 事件源控件ID
    function yyPOP(ly,aly)
    {
        bodySize = getwz(aly);  
        M(ly).style.display = 'block';
        popChange(1,ly,100,100,10);    
    }
 
    //传element过来的
    function yyPOP1(ly,ele)
    {
        bodySize = getwz1(ele);  
        M(ly).style.display = 'block';
        popChange(1,ly,100,100,10);    
    }
 
     //直接显示在控件下方
     function yyPoPsee(ly,aly,hei,wid)
     {
         bodySize = getwz(aly);  
         M(ly).style.display = 'block';
         bodySize[1]=bodySize[1]+TakePX(M(aly).style.height)
         popSee(ly,hei,wid);
     }
     
     function TakePX(pxvalue)
     {
        return Number(pxvalue.toString().substring(0,pxvalue.toString().indexOf("px")));
     }
    
 
    var bodySize;    
    function popChange(i,ly,hei,wid,seed)
    {
       var login = M(ly);
       if(bodySize[0]>i)
       login.style.left = i+"px";
       if(bodySize[1]>i)
       login.style.top = i+"px";
       if(i<wid);//宽
       login.style.width = i + "px";
       if(i<hei)//高
       login.style.height = i+ "px";   
       if(bodySize[1]>i||bodySize[0]>i||i<wid||i<hei)
       {
              i+=seed;
              setTimeout("popChange("+i+",'"+ly+"',"+hei+","+wid+","+seed+")",1);//设置超时10毫秒
       }  
    }
    
    function popSee(ly,hei,wid)
    {
         var login = M(ly);
         login.style.left = bodySize[0]+"px";
         login.style.top = bodySize[1]+"px";
         login.style.width = wid + "px";
         login.style.height = hei+"px";   
    }

    function getwz(aly)
    {
        var wz=[];
        wz[0]= getObjectLeft(M(aly));
        wz[1]=getObjectTop(M(aly));
        return wz;
    }

    function getwz1(aly)
    {
        var wz=[];
        wz[0]= getObjectLeft(aly);
        wz[1]=getObjectTop(aly);
        return wz;
    }


    function getObjectLeft(el)  
    {  
        var   l=el.offsetLeft;  
        while(el=el.offsetParent)   l   +=   el.offsetLeft;  
        return   l;  
    }  
   
    function   getObjectTop(et)  
    {  
        var   t=et.offsetTop;  
        while(et=et.offsetParent)   t   +=   et.offsetTop;  
        return   t;  
    }   

    function M(id)
    {
        return document.getElementById(id);//用M()方法代替document.getElementById(id)
    }

    function divnone(divid)
    {
        M(divid).style.display = 'none';
    }
    
    function CollectVillage(vid)
{
    var result=YY_Common.CollectVillage(vid);
    if(result.value!="")
    {
        alert(result.value);
    }
}
